import re

import requests


# 备用站点地址 https://www.kanxitv.com/

# 代理
proxies = {
    'http': '127.0.0.1:1080',
    'https': '127.0.0.1:1080'
}

url = 'https://www.fanboai.com/play/353900/1/1/'
headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36',
    'Referer': 'https://www.fanboai.com/html/353900/',
}
res = requests.get(url=url,proxies=proxies,headers=headers)


html_source = res.text

pairs = dict(re.findall(r'"(\w+)"\s*:\s*"([^"]*)"', html_source))

# 当前集
url = pairs.get('url', '').replace('\\/', '/')
# 下一集
url_next = pairs.get('url_next', '').replace('\\/', '/')


# 推荐的前端兼容写法
# 如果你要在自己页面内集成，并且兼容所有主流浏览器，用hls.js和一个video元素即可
# <video id="myVideo" controls autoplay></video>
# <script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
# <script>
#     var video = document.getElementById('myVideo');
#     if (Hls.isSupported()) {
#         var hls = new Hls();
#         hls.loadSource('https://wwzycdn.10cong.com/20250717/013EiWED/index.m3u8');
#         hls.attachMedia(video);
#     } else if (video.canPlayType('application/vnd.apple.mpegurl')) {
#         // Safari原生支持
#         video.src = 'https://wwzycdn.10cong.com/20250717/013EiWED/index.m3u8';
#     }
# </script>